<!--
 * @Author: your name
 * @Date: 2022-03-10 09:55:34
 * @LastEditTime: 2022-03-10 10:25:58
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \day10\4-location.html
-->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        window.onload=function(){
            console.log(location);
            var btn1=document.getElementById('btn1');
            var btn2=document.getElementById('btn2');
            var btn3=document.getElementById('btn3');

            btn1.onclick=function(){
                //跳转页面 且产生历史记录 参数url地址
               location.assign('./2-时间.html')
               //有历史记录产生
              // location.href='./3-系统对话框.html';
              //
             // window.open('./3-系统对话框.html');//也不产生历史记录
            }
            btn2.onclick=function(){
                //不会产生记录
                location.replace('./2-时间.html')
            }
            btn3.onclick=function(){
                location.reload(false);  //小刷---向浏览器缓存中请求数据
                location.reload(true);   //大刷 ---强制向服务器请求数据
            }
            var btn4=document.getElementById('forward');
            btn4.onclick=function(){
                history.forward()
            }
            console.log(history.length);
        }
        
    </script>
</head>
<body>
    <button id="btn1">跳转页面</button>
    <button id="btn2">替换页面</button>
    <button id="btn3">刷新页面</button>
    <button id="forward">前进一页</button>
</body>
</html>